using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._ImageAnalystTools._DeepLearning
{
    /// <summary>
    /// <para>Compute Accuracy For Object Detection</para>
    /// <para>Calculates the accuracy of a deep learning model by comparing the detected objects from the Detect Objects Using Deep Learning tool to ground truth data.</para>
    /// <para>通过将使用深度学习检测对象工具中检测到的对象与地面实况数据进行比较，计算深度学习模型的准确性。</para>
    /// </summary>    
    [DisplayName("Compute Accuracy For Object Detection")]
    public class ComputeAccuracyForObjectDetection : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public ComputeAccuracyForObjectDetection()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_detected_features">
        /// <para>Detected Features</para>
        /// <para>The polygon feature class containing the objects detected from the Detect Objects Using Deep Learning tool.</para>
        /// <para>包含从使用深度学习检测对象工具检测到的对象的面要素类。</para>
        /// </param>
        /// <param name="_ground_truth_features">
        /// <para>Ground Truth Features</para>
        /// <para>The polygon feature class containing ground truth data.</para>
        /// <para>包含地面实况数据的面要素类。</para>
        /// </param>
        /// <param name="_out_accuracy_table">
        /// <para>Output Accuracy Table</para>
        /// <para>The output accuracy table.</para>
        /// <para>输出精度表。</para>
        /// </param>
        public ComputeAccuracyForObjectDetection(object _detected_features, object _ground_truth_features, object _out_accuracy_table)
        {
            this._detected_features = _detected_features;
            this._ground_truth_features = _ground_truth_features;
            this._out_accuracy_table = _out_accuracy_table;
        }
        public override string ToolboxName => "Image Analyst Tools";

        public override string ToolName => "Compute Accuracy For Object Detection";

        public override string CallName => "ia.ComputeAccuracyForObjectDetection";

        public override List<string> AcceptEnvironments => ["extent", "scratchWorkspace", "workspace"];

        public override object[] ParameterInfo => [_detected_features, _ground_truth_features, _out_accuracy_table, _out_accuracy_report, _detected_class_value_field, _ground_truth_class_value_field, _min_iou, _mask_features];

        /// <summary>
        /// <para>Detected Features</para>
        /// <para>The polygon feature class containing the objects detected from the Detect Objects Using Deep Learning tool.</para>
        /// <para>包含从使用深度学习检测对象工具检测到的对象的面要素类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Detected Features")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _detected_features { get; set; }


        /// <summary>
        /// <para>Ground Truth Features</para>
        /// <para>The polygon feature class containing ground truth data.</para>
        /// <para>包含地面实况数据的面要素类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Ground Truth Features")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _ground_truth_features { get; set; }


        /// <summary>
        /// <para>Output Accuracy Table</para>
        /// <para>The output accuracy table.</para>
        /// <para>输出精度表。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Accuracy Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_accuracy_table { get; set; }


        /// <summary>
        /// <para>Output Accuracy Report</para>
        /// <para>The name of the output accuracy report. The report is a PDF document containing accuracy metrics and charts.</para>
        /// <para>输出精度报告的名称。该报告是一个包含准确性指标和图表的 PDF 文档。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Accuracy Report")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _out_accuracy_report { get; set; } = null;


        /// <summary>
        /// <para>Detected Class Value Field</para>
        /// <para><xdoc>
        ///   <para>The field in the detected objects feature class that contains the class values or class names.</para>
        ///   <para>If a field name is not specified, a Classvalue or Value field will be used. If these fields do not exist, all records will be identified as belonging to one class.</para>
        ///   <para>The class values or class names must match those in the ground reference feature class exactly.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>检测到的对象要素类中包含类值或类名的字段。</para>
        ///   <para>如果未指定字段名称，则将使用 Classvalue 或 Value 字段。如果这些字段不存在，则所有记录都将标识为属于一个类。</para>
        ///   <para>类值或类名称必须与地面参考要素类中的值或类名称完全匹配。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Detected Class Value Field")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _detected_class_value_field { get; set; } = null;


        /// <summary>
        /// <para>Ground Truth Class Value Field</para>
        /// <para><xdoc>
        ///   <para>The field in the ground truth feature class that contains the class values.</para>
        ///   <para>If a field name is not specified, a Classvalue or Value field will be used. If these fields do not exist, all records will be identified as belonging to one class.</para>
        ///   <para>The class values or class names must match those in the detected objects feature class exactly.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>地面实况要素类中包含类值的字段。</para>
        ///   <para>如果未指定字段名称，则将使用 Classvalue 或 Value 字段。如果这些字段不存在，则所有记录都将标识为属于一个类。</para>
        ///   <para>类值或类名必须与检测到的对象要素类中的值或类名完全匹配。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Ground Truth Class Value Field")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _ground_truth_class_value_field { get; set; } = null;


        /// <summary>
        /// <para>Minimum Intersection Over Union (IoU)</para>
        /// <para>The IoU ratio to use as a threshold to evaluate the accuracy of the object-detection model. The numerator is the area of overlap between the predicted bounding box and the ground reference bounding box. The denominator is the area of union or the area encompassed by both bounding boxes. The IoU ranges from 0 to 1.</para>
        /// <para>用作评估对象检测模型准确性的阈值的 IoU 比率。分子是预测边界框和地面参考边界框之间的重叠区域。分母是并集面积或两个边界框所包含的面积。IoU 的范围从 0 到 1。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Minimum Intersection Over Union (IoU)")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double _min_iou { get; set; } = 0.5;


        /// <summary>
        /// <para>Mask Features</para>
        /// <para>A polygon feature class that delineates the area or areas where accuracy will be computed. Only the features that intersect the mask will be assessed for accuracy.</para>
        /// <para>一个面要素类，用于描绘将计算精度的一个或多个区域。仅评估与掩模相交的特征的准确性。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Mask Features")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _mask_features { get; set; } = null;


        public ComputeAccuracyForObjectDetection SetEnv(object extent = null, object scratchWorkspace = null, object workspace = null)
        {
            base.SetEnv(extent: extent, scratchWorkspace: scratchWorkspace, workspace: workspace);
            return this;
        }

    }

}